package trss.service.impl;

import java.util.List;
import javax.jws.WebService;

import trss.dao.TorrentDao;
import trss.dao.UserDao;
import trss.model.Torrent;
import trss.model.User;
import trss.service.TorrentManager;
import trss.service.UserExistsException;
import trss.service.UserManager;
import trss.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.orm.jpa.JpaSystemException;
import org.springframework.security.authentication.encoding.PasswordEncoder;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;


/**
 * Implementation of TorrentManager interface.
 */
@Service("torrentManager")
public class TorrentManagerImpl extends GenericManagerImpl<Torrent, Long> implements TorrentManager {


    private TorrentDao torrentDao;

    /**
    * ${@inheritDoc}
    */
    @Autowired
    public void setTorrentDao(TorrentDao dao) {
        this.torrentDao = dao;
        this.dao = dao;
    }

    /**
    * ${@inheritDoc}
    */
    public List<Torrent> getTorrents(User user, int maxCount) {
        return torrentDao.get(user, maxCount);
    }

	@Override
	public Torrent save(Torrent torrent) {
		return torrentDao.saveTorrent(torrent);
	}
    
}
